﻿namespace ExamV5.GradeInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmShowExamAN : Page
    {
        protected Button butQuery;
        protected DropDownList DDLDept;
        protected DropDownList DDLSubject;
        protected DropDownList DDLUPDept;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private HttpCookie httpCookie_4 = null;
        private int int_0 = 1;
        protected Label labtableInfo;
        protected Label labTitle;
        private PublicFun publicFun_0 = new PublicFun();
        protected ScriptManager SM;
        private string string_0 = "0";
        protected TextBox txtEndDate;
        protected TextBox txtStartDate;
        protected UpdatePanel UPPart;

        protected void butQuery_Click(object sender, EventArgs e)
        {
            this.method_0();
        }

        protected void DDLDept_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.method_0();
        }

        protected void DDLSubject_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.method_0();
        }

        protected void DDLUPDept_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.DDLDept.Items.Clear();
            this.publicFun_0.LoadDeptInfo(this.DDLDept, this.DDLUPDept.SelectedItem.Value, this.httpCookie_0.Value, "B");
            if (this.DDLDept.Items.Count == 0)
            {
                if (!(this.DDLUPDept.SelectedItem.Value == "0"))
                {
                    ListItem item = new ListItem(this.DDLUPDept.SelectedItem.Text, this.DDLUPDept.SelectedItem.Value);
                    this.DDLDept.Items.Add(item);
                }
                else
                {
                    ListItem item2 = new ListItem("--所有部门--", "0");
                    this.DDLDept.Items.Insert(0, item2);
                }
            }
        }

        private void method_0()
        {
            this.labtableInfo.Text = "";
            this.labTitle.Text = "";
            if ((this.txtStartDate.Text.Trim() != "") && (this.txtEndDate.Text.Trim() != ""))
            {
                this.labTitle.Text = Convert.ToDateTime(this.txtStartDate.Text).ToLongDateString() + "—" + Convert.ToDateTime(this.txtEndDate.Text).ToLongDateString();
            }
            this.labTitle.Text = this.labTitle.Text + "〖" + this.DDLDept.SelectedItem.Text.Replace("│", "").Replace("├", "") + "〗〖" + this.publicFun_0.CheckString(this.DDLSubject.SelectedItem.Text.Replace("│", "").Replace("├", "")) + "〗科目考试成绩综合统计分析表";
            if (!(this.DDLDept.SelectedItem.Value == "0"))
            {
                this.method_1(this.DDLDept.SelectedItem.Value, this.DDLDept.SelectedItem.Text.Replace("│", "").Replace("├", ""), this.DDLDept.SelectedItem.Value);
                this.string_0 = this.DDLDept.SelectedItem.Value;
            }
            else if (!(this.httpCookie_2.Value == "C"))
            {
                this.method_1(this.DDLDept.SelectedItem.Value, this.DDLDept.SelectedItem.Text.Replace("│", "").Replace("├", ""), this.DDLDept.SelectedItem.Value);
                this.string_0 = this.DDLDept.SelectedItem.Value;
            }
            else
            {
                this.method_1("0", "单位总表", "0");
                this.string_0 = "0";
            }
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlDataReader reader = new SqlCommand("select ID,DeptName from DeptInfo where UPID=" + this.string_0 + " order by SortInfo", connection).ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                this.method_1(reader["ID"].ToString(), reader["DeptName"].ToString(), "1");
            }
            reader.Close();
            connection.Close();
            connection.Dispose();
        }

        private void method_1(string string_1, string string_2, string string_3)
        {
            string str = "";
            str = "<tr>";
            str = ((((((((((((((((((((((((((((((str + "<td>") + "<table cellSpacing='0' cellPadding='0' width='100%' align='center' border='0'>" + "<tr>") + "<td width='50%'>单位：(" + string_2 + ")</td>") + "<td width='50%' align='right'> </td>") + "</tr>" + "<tr>") + "<td colspan='2'>" + "<table cellSpacing='0' cellPadding='0' width='100%' align='center' border='1' bordercolordark='#cccccc' bordercolorlight='#cccccc'  bordercolor='#cccccc'  class='tableStyle'>") + "<tr>" + "<td rowspan='3' align='center' width=30>序号</td>") + "<td rowspan='3' align='center'>单位/部门名称</td>" + "<td rowspan='2' align='center' width=70>应考人数</td>") + "<td rowspan='2' align='center' width=70>实考人数</td>" + "<td rowspan='2' align='center' width=60>实考比例</td>") + "<td colspan='2' align='center' width=120>" + this.publicFun_0.GetValues("select ReuleName+'('+Convert(varchar,MinValue)+'-'+Convert(varchar,MaxValue)+')' as ReuleNameTmp from GradeReule where PaperID=0 and StandFlag='D'", "ReuleNameTmp") + "</td>") + "<td colspan='2' align='center' width=120>" + this.publicFun_0.GetValues("select ReuleName+'('+Convert(varchar,MinValue)+'-'+Convert(varchar,MaxValue)+')' as ReuleNameTmp from GradeReule where PaperID=0 and StandFlag='C'", "ReuleNameTmp") + "</td>") + "<td colspan='2' align='center' width=120>" + this.publicFun_0.GetValues("select ReuleName+'('+Convert(varchar,MinValue)+'-'+Convert(varchar,MaxValue)+')' as ReuleNameTmp from GradeReule where PaperID=0 and StandFlag='B'", "ReuleNameTmp") + "</td>") + "<td colspan='2' align='center' width=120>" + this.publicFun_0.GetValues("select ReuleName+'('+Convert(varchar,MinValue)+'-'+Convert(varchar,MaxValue)+')' as ReuleNameTmp from GradeReule where PaperID=0 and StandFlag='A'", "ReuleNameTmp") + "</td>") + "<td rowspan='2' align='center' width=45>平均分</td>") + "<td rowspan='2' align='center' width=35>排名</td>" + "</tr>") + "<tr>" + "<td align='center' width=50>人数</td>") + "<td align='center' width=60>未及格率</td>" + "<td align='center' width=50>人数</td>") + "<td align='center' width=60>应考比例</td>" + "<td align='center' width=50>人数</td>") + "<td align='center' width=60>应考比例</td>" + "<td align='center' width=50>人数</td>") + "<td align='center' width=60>应考比例</td>" + "</tr>") + "<tr>" + "<td align='center'>人</td>") + "<td align='center'>人</td>" + "<td align='center'>％</td>") + "<td align='center'>人</td>" + "<td align='center'>％</td>") + "<td align='center'>人</td>" + "<td align='center'>％</td>") + "<td align='center'>人</td>" + "<td align='center'>％</td>") + "<td align='center'>人</td>" + "<td align='center'>％</td>") + "<td align='center'>分</td>" + "<td align='center'>&nbsp;</td>") + "</tr>" + this.method_2(string_1, string_3)) + "</table>" + "</td>") + "</tr>" + "</table>") + "</td>" + "</tr>";
            this.labtableInfo.Text = this.labtableInfo.Text + str + "<tr height=30><td></td><tr>";
        }

        private string method_2(string string_1, string string_2)
        {
            string str = "";
            string values = "";
            int num = 0;
            double num2 = 0.0;
            double num3 = 0.0;
            if (this.DDLSubject.SelectedItem.Value != "0")
            {
                str = " and a.Subject like '%" + this.publicFun_0.CheckString(this.DDLSubject.SelectedItem.Text.Replace("│", "").Replace("├", "")) + "%'";
            }
            else
            {
                str = " and a.PaperID!=0";
            }
            if (this.txtStartDate.Text.Trim() != "")
            {
                str = str + " and Convert(dateTime,a.JoinDate)>=Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtStartDate.Text.Trim()) + " 00:00:00')";
            }
            if (this.txtEndDate.Text.Trim() != "")
            {
                str = str + " and Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtEndDate.Text.Trim()) + " 23:59:59')>=Convert(dateTime,a.JoinDate)";
            }
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            values = this.publicFun_0.GetValues("select Count(*) as DeptCount from DeptInfo where UPID=" + string_1, "DeptCount");
            if (values.Trim() != "")
            {
                this.int_0 = Convert.ToInt32(values.Trim());
            }
            string[,] strArray = new string[this.int_0, 0x10];
            string str25 = "0";
            string str26 = "59";
            string str23 = "60";
            string str24 = "79";
            string str21 = "80";
            string str22 = "89";
            string str19 = "90";
            string str20 = "10000";
            SqlConnection connection2 = new SqlConnection(connectionString);
            connection2.Open();
            SqlCommand command = new SqlCommand("select MinValue,MaxValue,StandFlag from GradeReule where PaperID=0 order by StandFlag desc", connection2);
            SqlDataReader reader2 = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader2.Read())
            {
                switch (reader2["StandFlag"].ToString())
                {
                    case null:
                    {
                        continue;
                    }
                    case "D":
                    {
                        str25 = reader2["MinValue"].ToString();
                        str26 = reader2["MaxValue"].ToString();
                        continue;
                    }
                    case "C":
                        str23 = reader2["MinValue"].ToString();
                        str24 = reader2["MaxValue"].ToString();
                        break;

                    case "B":
                        str21 = reader2["MinValue"].ToString();
                        str22 = reader2["MaxValue"].ToString();
                        break;

                    case "A":
                        str19 = reader2["MinValue"].ToString();
                        str20 = reader2["MaxValue"].ToString();
                        break;
                }
            }
            reader2.Close();
            command.Dispose();
            connection2.Close();
            connection2.Dispose();
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            SqlDataReader reader = new SqlCommand("select ID,DeptName from DeptInfo where UPID=" + string_1, connection).ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                strArray[num, 0] = reader["ID"].ToString();
                strArray[num, 1] = reader["DeptName"].ToString();
                strArray[num, 2] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.UserCode=b.UserCode " + str + " and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                strArray[num, 3] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.UserCode=b.UserCode " + str + " and a.Flag<>'A' and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                if (!(strArray[num, 2].Trim() != "0"))
                {
                    strArray[num, 4] = "0";
                }
                else
                {
                    num3 = Convert.ToDouble(strArray[num, 3].Trim()) / Convert.ToDouble(strArray[num, 2].Trim());
                    num3 *= 100.0;
                    strArray[num, 4] = num3.ToString("0.00");
                }
                strArray[num, 5] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.Flag<>'A'  " + str + "  and a.UserCode=b.UserCode and (a.GetCountFen>=" + str25 + " and a.GetCountFen<=" + str26 + ") and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                if (strArray[num, 3].Trim() != "0")
                {
                    num3 = Convert.ToDouble(strArray[num, 5].Trim()) / Convert.ToDouble(strArray[num, 3].Trim());
                    num3 *= 100.0;
                    strArray[num, 6] = num3.ToString("0.00");
                }
                else
                {
                    strArray[num, 6] = "0";
                }
                strArray[num, 7] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.Flag<>'A'  " + str + "  and a.UserCode=b.UserCode and (a.GetCountFen>=" + str23 + " and a.GetCountFen<=" + str24 + ") and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                if (!(strArray[num, 3].Trim() != "0"))
                {
                    strArray[num, 8] = "0";
                }
                else
                {
                    num3 = Convert.ToDouble(strArray[num, 7].Trim()) / Convert.ToDouble(strArray[num, 3].Trim());
                    num3 *= 100.0;
                    strArray[num, 8] = num3.ToString("0.00");
                }
                strArray[num, 9] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.Flag<>'A'  " + str + "  and a.UserCode=b.UserCode and (a.GetCountFen>=" + str21 + " and a.GetCountFen<=" + str22 + ") and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                if (!(strArray[num, 3].Trim() != "0"))
                {
                    strArray[num, 10] = "0";
                }
                else
                {
                    num3 = Convert.ToDouble(strArray[num, 9].Trim()) / Convert.ToDouble(strArray[num, 3].Trim());
                    num3 *= 100.0;
                    strArray[num, 10] = num3.ToString("0.00");
                }
                strArray[num, 11] = this.publicFun_0.GetValues("select Count(*) as UserCount from ExamUser a,UserInfo b where a.Flag<>'A'  " + str + " and  a.UserCode=b.UserCode and (a.GetCountFen>=" + str19 + " and a.GetCountFen<=" + str20 + ") and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "UserCount");
                if (!(strArray[num, 3].Trim() != "0"))
                {
                    strArray[num, 12] = "0";
                }
                else
                {
                    num3 = Convert.ToDouble(strArray[num, 11].Trim()) / Convert.ToDouble(strArray[num, 3].Trim());
                    num3 *= 100.0;
                    strArray[num, 12] = num3.ToString("0.00");
                }
                values = this.publicFun_0.GetValues("select round(sum(GetCountFen),2) as GetCountFen  from ExamUser a,UserInfo b where a.Flag<>'A'  " + str + "  and  a.UserCode=b.UserCode and b.DeptID in( select b.ID from DeptInfo b where " + this.publicFun_0.GetManagDeptID(reader["ID"].ToString()) + ")", "GetCountFen");
                if (!(values.Trim() != ""))
                {
                    num2 = 0.0;
                }
                else
                {
                    num2 = Convert.ToDouble(values.Trim());
                }
                string str18 = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='GradeReport'", "ParmValue").Trim();
                if (!(!(str18.Trim() == "") ? !(str18.Trim() == "Y") : false))
                {
                    if (strArray[num, 3].Trim() != "0")
                    {
                        num3 = Convert.ToDouble(strArray[num, 2].Trim());
                        num3 = num2 / num3;
                        strArray[num, 14] = num3.ToString("0.00");
                    }
                    else
                    {
                        strArray[num, 14] = "0.00";
                    }
                }
                else if (strArray[num, 3].Trim() != "0")
                {
                    num3 = Convert.ToDouble(strArray[num, 3].Trim());
                    num3 = num2 / num3;
                    strArray[num, 14] = num3.ToString("0.00");
                }
                else
                {
                    strArray[num, 14] = "0.00";
                }
                strArray[num, 15] = "0";
                num++;
            }
            reader.Close();
            connection.Close();
            connection.Dispose();
            string str16 = "合计";
            string str15 = "0";
            string str7 = "0";
            string str17 = "0";
            string str14 = "0";
            string str13 = "0";
            string str12 = "0";
            string str11 = "0";
            string str10 = "0";
            string str9 = "0";
            string str8 = "0";
            string str6 = "0";
            string str5 = "0";
            values = "";
            for (int i = 0; i < this.int_0; i++)
            {
                for (int k = 0; k < i; k++)
                {
                    if (Convert.ToDouble(strArray[i, 14]) >= Convert.ToDouble(strArray[k, 14]))
                    {
                        values = strArray[i, 0];
                        strArray[i, 0] = strArray[k, 0];
                        strArray[k, 0] = values;
                        values = strArray[i, 1];
                        strArray[i, 1] = strArray[k, 1];
                        strArray[k, 1] = values;
                        values = strArray[i, 2];
                        strArray[i, 2] = strArray[k, 2];
                        strArray[k, 2] = values;
                        values = strArray[i, 3];
                        strArray[i, 3] = strArray[k, 3];
                        strArray[k, 3] = values;
                        values = strArray[i, 4];
                        strArray[i, 4] = strArray[k, 4];
                        strArray[k, 4] = values;
                        values = strArray[i, 5];
                        strArray[i, 5] = strArray[k, 5];
                        strArray[k, 5] = values;
                        values = strArray[i, 6];
                        strArray[i, 6] = strArray[k, 6];
                        strArray[k, 6] = values;
                        values = strArray[i, 7];
                        strArray[i, 7] = strArray[k, 7];
                        strArray[k, 7] = values;
                        values = strArray[i, 8];
                        strArray[i, 8] = strArray[k, 8];
                        strArray[k, 8] = values;
                        values = strArray[i, 9];
                        strArray[i, 9] = strArray[k, 9];
                        strArray[k, 9] = values;
                        values = strArray[i, 10];
                        strArray[i, 10] = strArray[k, 10];
                        strArray[k, 10] = values;
                        values = strArray[i, 11];
                        strArray[i, 11] = strArray[k, 11];
                        strArray[k, 11] = values;
                        values = strArray[i, 12];
                        strArray[i, 12] = strArray[k, 12];
                        strArray[k, 12] = values;
                        values = strArray[i, 14];
                        strArray[i, 14] = strArray[k, 14];
                        strArray[k, 14] = values;
                    }
                }
            }
            values = "";
            int num7 = 0;
            double num6 = 0.0;
            double num5 = 0.0;
            for (int j = 0; j < this.int_0; j++)
            {
                num = 0;
                num = j + 1;
                values = values + "<tr height=30>";
                values = ((((((((((((string.Concat(new object[] { values, "<td align='center'>", num, "</td>" }) + "<td align='center'>" + strArray[j, 1].Trim() + "</td>") + "<td align='center'>" + strArray[j, 2].Trim() + "</td>") + "<td align='center'>" + strArray[j, 3].Trim() + "</td>") + "<td align='center'>" + strArray[j, 4].Trim() + "</td>") + "<td align='center'>" + strArray[j, 5].Trim() + "</td>") + "<td align='center'>" + strArray[j, 6].Trim() + "</td>") + "<td align='center'>" + strArray[j, 7].Trim() + "</td>") + "<td align='center'>" + strArray[j, 8].Trim() + "</td>") + "<td align='center'>" + strArray[j, 9].Trim() + "</td>") + "<td align='center'>" + strArray[j, 10].Trim() + "</td>") + "<td align='center'>" + strArray[j, 11].Trim() + "</td>") + "<td align='center'>" + strArray[j, 12].Trim() + "</td>") + "<td align='center'>" + strArray[j, 14].Trim() + "</td>";
                num5 = Convert.ToDouble(strArray[j, 14].Trim());
                if (j == 0)
                {
                    values = values + "<td align='center'><B>1</B></td>";
                    num7 = 1;
                }
                else if (num5 == num6)
                {
                    values = string.Concat(new object[] { values, "<td align='center'><B>", num7, "</B></td>" });
                }
                else
                {
                    num7++;
                    values = string.Concat(new object[] { values, "<td align='center'><B>", num7, "</B></td>" });
                }
                num6 = num5;
                values = values + "</tr>";
                if (num == 1)
                {
                    str15 = strArray[j, 2].Trim();
                    str7 = strArray[j, 3].Trim();
                    str17 = strArray[j, 4].Trim();
                    str14 = strArray[j, 5].Trim();
                    str13 = strArray[j, 6].Trim();
                    str12 = strArray[j, 7].Trim();
                    str11 = strArray[j, 8].Trim();
                    str10 = strArray[j, 9].Trim();
                    str9 = strArray[j, 10].Trim();
                    str8 = strArray[j, 11].Trim();
                    str6 = strArray[j, 12].Trim();
                    str5 = strArray[j, 14].Trim();
                }
                else
                {
                    str15 = Convert.ToString((double) (Convert.ToDouble(str15) + Convert.ToDouble(strArray[j, 2].Trim())));
                    str7 = Convert.ToString((double) (Convert.ToDouble(str7) + Convert.ToDouble(strArray[j, 3].Trim())));
                    str17 = Convert.ToString((double) (Convert.ToDouble(str17) + Convert.ToDouble(strArray[j, 4].Trim())));
                    str14 = Convert.ToString((double) (Convert.ToDouble(str14) + Convert.ToDouble(strArray[j, 5].Trim())));
                    str13 = Convert.ToString((double) (Convert.ToDouble(str13) + Convert.ToDouble(strArray[j, 6].Trim())));
                    str12 = Convert.ToString((double) (Convert.ToDouble(str12) + Convert.ToDouble(strArray[j, 7].Trim())));
                    str11 = Convert.ToString((double) (Convert.ToDouble(str11) + Convert.ToDouble(strArray[j, 8].Trim())));
                    str10 = Convert.ToString((double) (Convert.ToDouble(str10) + Convert.ToDouble(strArray[j, 9].Trim())));
                    str9 = Convert.ToString((double) (Convert.ToDouble(str9) + Convert.ToDouble(strArray[j, 10].Trim())));
                    str8 = Convert.ToString((double) (Convert.ToDouble(str8) + Convert.ToDouble(strArray[j, 11].Trim())));
                    str6 = Convert.ToString((double) (Convert.ToDouble(str6) + Convert.ToDouble(strArray[j, 12].Trim())));
                    str5 = Convert.ToString((double) (Convert.ToDouble(str5) + Convert.ToDouble(strArray[j, 14].Trim())));
                }
                if (num == this.int_0)
                {
                    values = (((values + "<tr height=30>" + "<td align='center'>&nbsp;</td>") + "<td align='center'><B>" + str16 + "</B></td>") + "<td align='center'><B>" + str15 + "</B></td>") + "<td align='center'><B>" + str7 + "</B></td>";
                    if (!(str15.Trim() != "0"))
                    {
                        values = values + "<td align='center'><B>0</B></td>";
                    }
                    else
                    {
                        num3 = Convert.ToDouble(str7.Trim()) / Convert.ToDouble(str15.Trim());
                        num3 *= 100.0;
                        values = values + "<td align='center'><B>" + num3.ToString("0.00") + "</B></td>";
                    }
                    values = values + "<td align='center'><B>" + str14 + "</B></td>";
                    if (!(str7.Trim() != "0"))
                    {
                        str13 = "0";
                    }
                    else
                    {
                        num3 = Convert.ToDouble(str14.Trim()) / Convert.ToDouble(str7.Trim());
                        num3 *= 100.0;
                        str13 = num3.ToString("0.00");
                    }
                    values = (values + "<td align='center'><B>" + str13 + "</B></td>") + "<td align='center'><B>" + str12 + "</B></td>";
                    if (!(str7.Trim() != "0"))
                    {
                        str11 = "0";
                    }
                    else
                    {
                        num3 = Convert.ToDouble(str12.Trim()) / Convert.ToDouble(str7.Trim());
                        num3 *= 100.0;
                        str11 = num3.ToString("0.00");
                    }
                    values = (values + "<td align='center'><B>" + str11 + "</B></td>") + "<td align='center'><B>" + str10 + "</B></td>";
                    if (!(str7.Trim() != "0"))
                    {
                        str9 = "0";
                    }
                    else
                    {
                        num3 = Convert.ToDouble(str10.Trim()) / Convert.ToDouble(str7.Trim());
                        num3 *= 100.0;
                        str9 = num3.ToString("0.00");
                    }
                    values = (values + "<td align='center'><B>" + str9 + "</B></td>") + "<td align='center'><B>" + str8 + "</B></td>";
                    if (!(str7.Trim() != "0"))
                    {
                        str6 = "0";
                    }
                    else
                    {
                        num3 = Convert.ToDouble(str8.Trim()) / Convert.ToDouble(str7.Trim());
                        num3 *= 100.0;
                        str6 = num3.ToString("0.00");
                    }
                    values = values + "<td align='center'><B>" + str6 + "</B></td>";
                    if (!(str7.Trim() != "0"))
                    {
                        str5 = "0";
                    }
                    else
                    {
                        str5 = (Convert.ToDouble(str5.Trim()) / Convert.ToDouble(this.int_0)).ToString("0.00");
                    }
                    values = (values + "<td align='center'><B>" + str5 + "</B></td>") + "<td align='center'>&nbsp;</td>" + "</tr>";
                }
            }
            return values;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.httpCookie_4 = new HttpCookie("ExamDeptName");
            this.httpCookie_4 = base.Request.Cookies["ExamDeptName"];
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.httpCookie_4.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_4.Value));
                this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString + "---考试成绩综合报表分析";
                if (!base.IsPostBack)
                {
                    if (this.publicFun_0.ReturnPaperData() != "Yes")
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')", true);
                    }
                    else if (this.httpCookie_2.Value != "A")
                    {
                        this.DDLUPDept.DataTextField = "DeptName";
                        this.DDLUPDept.DataValueField = "ID";
                        if (!(this.httpCookie_2.Value == "C"))
                        {
                            this.DDLUPDept.DataSource = this.publicFun_0.RetrunDataView("select ID,DeptName from DeptInfo where ID=" + this.httpCookie_3.Value + " order by SortInfo,ID");
                        }
                        else
                        {
                            this.DDLUPDept.DataSource = this.publicFun_0.RetrunDataView("select ID,DeptName from DeptInfo where UPID=0  order by SortInfo,ID");
                        }
                        this.DDLUPDept.DataBind();
                        if (!(this.httpCookie_2.Value == "C"))
                        {
                            this.DDLDept.Items.Clear();
                            this.publicFun_0.LoadDeptInfo(this.DDLDept, this.DDLUPDept.SelectedItem.Value, this.httpCookie_0.Value, "B");
                            if (this.DDLDept.Items.Count == 0)
                            {
                                ListItem item = new ListItem(this.DDLUPDept.SelectedItem.Text, this.DDLUPDept.SelectedItem.Value);
                                this.DDLDept.Items.Add(item);
                            }
                        }
                        else
                        {
                            this.DDLUPDept.SelectedIndex = -1;
                            this.DDLDept.SelectedIndex = -1;
                            ListItem item2 = new ListItem("--所有单位--", "0");
                            ListItem item3 = new ListItem("--所有部门--", "0");
                            this.DDLDept.Items.Insert(0, item3);
                            this.DDLUPDept.Items.Insert(0, item2);
                        }
                        this.publicFun_0.LoadSubjectInfo(this.DDLSubject, this.httpCookie_0.Value, "N", "B", this.httpCookie_3.Value);
                        this.DDLSubject.Items.Insert(0, new ListItem("--所有科目信息--", "0"));
                        this.method_0();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheckA", "alert('考试成绩分析权限未开放！')", true);
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

